﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MotionControl.Modules.PLC.Business
{
    public class IOStatus : INotifyPropertyChanged
    {
        private string _name;
        private bool _enable;
        public bool Enable
        {
            get { return _enable; }
            set
            {
                OnPropertyChanged("Enable");
            }
        }
        public string Name { get; set; }

        public IOStatus(string name, bool enable)
        {
            Name = name;
            Enable = enable;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string info)
        {
            var handler = PropertyChanged;
            handler?.Invoke(this, new PropertyChangedEventArgs(info));
        }
    }

    public class IOList : ObservableCollection<IOStatus> {
        public IOList() {
            Add(new IOStatus("上相机轴原点", false));
            Add(new IOStatus("上相机轴正限位", false));
            Add(new IOStatus("上相机轴负限位", false));
            Add(new IOStatus("上相机轴ALM", false));
            Add(new IOStatus("下相机轴原点", false));
            Add(new IOStatus("下相机轴正限位", false));
            Add(new IOStatus("下相机轴负限位", false));
            Add(new IOStatus("下相机轴ALM", false));
            Add(new IOStatus("上吸附升降轴原点", false));
            Add(new IOStatus("上吸附升降轴正限位", false));
            Add(new IOStatus("上吸附升降轴负限位", false));
            Add(new IOStatus("上吸附升降轴ALM", false));
            Add(new IOStatus("光源升降轴原点", false));
            Add(new IOStatus("光源升降轴正限位", false));
            Add(new IOStatus("光源升降轴负限位", false));
            Add(new IOStatus("光源升降轴ALM", false));
            Add(new IOStatus("启动按钮", false));
            Add(new IOStatus("停止按钮", false));
            Add(new IOStatus("复位按钮", false));
            Add(new IOStatus("急停按钮", false));
            Add(new IOStatus("接近开关有料检测1", false));
            Add(new IOStatus("接近开关有料检测2", false));
            Add(new IOStatus("挡料气缸上限", false));
            Add(new IOStatus("挡料气缸下限", false));
            Add(new IOStatus("左偏移光电检测", false));
            Add(new IOStatus("右偏移光电检测", false));
        }
    }
}
